<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/tld/web-html" prefix="html"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>My JSP 'grid.jsp' starting page</title>
  </head>  
  <body>
<form action="" id="form1" name="form1">
<input type="hidden" id="pageIndex" name="pageIndex" value="">
</form>
<p>
<input type="button" name="fordelete" id="fordelete" onclick="fordelete()" value="删除数据">
</p>
<div  align="left">
<div id="table_div" align="left"></div>
<br>
<div id="pager_div"  align="left"></div>
</div>
<html:grid colunmName="id,name,endTime,updateTime" colunmShow="主键,用户名,有效期,更新时间"></html:grid>
<script type="text/javascript">
pager.onclick = function(index){
	document.getElementById("pageIndex").value=index;
	document.form1.action="<%=basePath %>MySevlet";
	document.form1.submit();
};
function fordelete(){
	var pk = table.getSelectedKeys();
	if(""==pk){
		alert("请选择一条记录！");
		return false;
	}
	if(pk.length > 1){
		alert("请选择一条记录！");
		return false;
	}
	alert("您选择了ID：" + pk + "！");
}
</script>
  </body>
</html>